@include('home.public.header')
<style>
    .coin_footer {
        background-color: #f8f8f8;
    }
</style>
<!--top end-->
<script src="/home/js/clipboard.min.js"></script>
<!--[if lt IE 9]>
<script>
    $(document).ready(function (e) {
        $(".cpybtn").on("click", function () {
            var inputTxt = $("#cpytxt").val();
            window.clipboardData.setData("Text", inputTxt);
            $(".cpypt").show();
            setTimeout(function () {
                $(".cpypt").hide();
            }, 1000);
        });
    });
</script>
<![endif]-->
<script>
    var clipboard = new Clipboard('#copy');
    clipboard.on('success', function (e) {
        console.log(e);
        alert("已复制");
        //$(".cpypt").show();
        //setTimeout(function(){$(".cpypt").hide();},1000);
    });

    clipboard.on('error', function (e) {
        console.log(e);
        alert("浏览器不支持直接复制，请选定连接后，ctrl+c复制");
    });

</script>
<div id="main">
    <div class="main_box">
        @include('home.public.left')
        <div class="raise right clearfix">
            <div class="ybc_list">
                <div class="ybcoin invitecon" style="border-bottom:1px solid #e2e2e2;">
                    <h2 class="left"><font style="color:red;font-size:14px;">&nbsp;</font></h2>
                    <div class="clear"></div>
                </div>
                <div class="ybcoin invitecon" style="margin-bottom:0;">
                    <h2>复制以下内容发送给你的好友<span style="margin-left:20px;color:red;">您的邀请码是:{{session('USER_KEY_ID')}}</span>
                    </h2>
                    <div>
                        <div class="left invitelink">
                            <textarea name="url"
                                      id="url">{{urlHome('Reg','getIndex',['member_id'=>session('USER_KEY_ID')],2)}}</textarea>
                            <input type="hidden" value="{$Think.session.USER_KEY_ID}" id="user_key_id">
                            <input type="hidden" value="{$Think.server.SERVER_NAME}" id="server_name">
                        </div>

                        <p class="right copylink" style="text-indent:0;" id="copy" data-clipboard-action="copy"
                           data-clipboard-target="#url">
                            <a href="javascript:void(0);">复制链接</a>

                            <!--<div style="position: absolute; left: 1090px; top: 252px; width: 122px; height: 42px; z-index: 99;" id="zclip-ZeroClipboardMovie_1" class="zclip">
                            <embed id="ZeroClipboardMovie_1" src="/ZeroClipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" name="ZeroClipboardMovie_1" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=1&amp;width=122&amp;height=42" wmode="transparent" align="middle" width="122" height="42">
                            </div>--></p>
                        <div class="clear"></div>
                    </div>
                </div>
                <div class="ybcoin invitecon">
                    <h3 style="height:28px;">把内容分享到以下空间</h3>

                    <div class="bdsharebuttonbox"><a href="#" class="bds_more" data-cmd="more"></a><a href="#"
                                                                                                      class="bds_qzone"
                                                                                                      data-cmd="qzone"
                                                                                                      title="分享到QQ空间"></a><a
                                href="#" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博"></a><a href="#"
                                                                                                   class="bds_tqq"
                                                                                                   data-cmd="tqq"
                                                                                                   title="分享到腾讯微博"></a><a
                                href="#" class="bds_renren" data-cmd="renren" title="分享到人人网"></a><a href="#"
                                                                                                    class="bds_weixin"
                                                                                                    data-cmd="weixin"
                                                                                                    title="分享到微信"></a>
                    </div>
                    <script>window._bd_share_config = {
                            "common": {
                                "bdUrl": "{{urlHome('Reg','getIndex',['member_id'=>session('USER_KEY_ID')],2)}}",
                                "bdSnsKey": {},
                                "bdText": "",
                                "bdMini": "2",
                                "bdPic": "",
                                "bdStyle": "0",
                                "bdSize": "16"
                            },
                            "share": {},
                            "image": {
                                "viewList": ["qzone", "tsina", "tqq", "renren", "weixin"],
                                "viewText": "分享到：",
                                "viewSize": "16"
                            },
                            "selectShare": {
                                "bdContainerClass": null,
                                "bdSelectMiniList": ["qzone", "tsina", "tqq", "renren", "weixin"]
                            }
                        };
                        with (document)0[(getElementsByTagName('head')[0] || body).appendChild(createElement('script')).src = 'http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion=' + ~(-new Date() / 36e5)];</script>
                </div>
                <div class="ybcoin invitecon">
                    <h2>或者发送至</h2>
                    <div>

                        <input id="emaillist" class="left email_link" placeholder="example@example.com, 不超过5个, 以 ; 隔开"
                               type="text">
                        <p class="right copylink" style="text-indent:0;"><input class="email_invite" value="发邮件邀请"
                                                                                type="button" onclick="sendmail()"></p>
                        <div class="clear"></div>

                    </div>
                </div>
                <div class="ybcoin invitecon">
                    <h2>{{$info['title'] or '邀请规则'}}</h2>
                    <ul class="rules">
                       {{$config['invite_rule']}}
                        <div class="clear"></div>
                    </ul>
                </div>
            </div>
            <div class="ybc_list">
                <div class="ybcoin">
                    <h2 class="left">我的邀请</h2>
                    <h2 class="right">邀请奖励总额: <span style="color:#f60;">>{{$count or '0'}}</span></h2>
                </div>
                <table class="raise_list" style="border:1px solid #e1e1df;" align="center" border="0" cellpadding="0"
                       cellspacing="0">
                    <thead>
                    <tr class="list_head">
                        <th>邮箱</th>
                        <th>状态</th>
                        <th>注册时间</th>
                    </tr>
                    </thead>
                    <tbody>
                    @if($my_invit['data'])
                        @foreach($my_invit['data'] as $v)
                            <tr>
                                <td>{{$v['email']}}</td>
                                <td>{{$v['status_name']}}</td>
                                <td>{{date('Y-m-d H:i:s',$v['reg_time'])}}</td>
                            </tr>
                        @endforeach
                    @endif
                    </tbody>
                </table>
            </div>
        </div>
        <div class="page" style=" min-width:200px !important; float:right;">

        </div>
        <div class="clear"></div>
    </div>
    <script>
        function sendmail() {
            url = "{{urlHome('user','postInvit')}}";
            var emailList = $('#emaillist').val();
            if (emailList.replace(/\s/g, '') === '') {
                alert("请填写邮箱内容");
                return false;
            } else {
                var arr = escape(emailList.replace(/(^\s*)|(\s*$)/g, "")).split('%3B'), error = '', emailrule = /\w+((-w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+/;
                if (arr.length > 5 && arr.length) {
                    alert("最多填写5个邮箱");
                    return false;
                } else {
                    for (var i = 0; i < arr.length; i++) {
                        if (!emailrule.test(arr[i])) {
                            var num = i + 1;
                            error += num + "、";
                        }
                    }
                }
                if (error != '') {
                    error = error.substr(0, error.length - 1);
                    alert("第" + error + "个邮箱格式不正确");
                    return false;
                }
                $.post(url, {emails: emailList}, function (data) {
                    if (data.status == 0) {
                        alert(data.info);
                    }
                    else {
                        alert('邀请成功');
                        window.location.reload();
                    }
                }, "json");
            }
        }

    </script>
    <script>
        $(".menu9").addClass("uc-current");
    </script>
@include('home.public.footer')